package com.zsrt.java.day20161223.wrl.demo02;

import java.util.Scanner;

import org.junit.Test;

public class SwitchDemo02 {
	
	/**
	 * 输入	数字+符号+数字
	 * 输出	结果
	 */
	@Test
	public void ca1(){
		//输入第1个数字
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入第1个数字：");
		int a = sc.nextInt();		
		
		//输入运算符
		System.out.println("请输入运算符：");
		String fuhao = sc.next();		
		
		//输入第2个数字
		System.out.println("请输入第2个数字：");
		int b = sc.nextInt();
		
		sc.close();
		
		switch (fuhao) {
			case "+":	System.out.println(a+b);	break;
			case "-":	System.out.println(a-b);	break;
			case "*":	System.out.println(a*b);	break;
			case "/":	System.out.println(a/b);	break;
			case "%":	System.out.println(a%b);	break;
			default:	System.out.println("--");	break;
		}
	}

}
